﻿using System;
using System.Web;
using System.Data;
using System.Web.UI.WebControls;
using System.IO;

using VIT.Web.UI;
using VIT.Web.Controls;
using VIT.Provider;
using VIT.Library;
using VIT.Library.Web;
using VIT.DataHelper.DataAccess;
using VIT.Wedding;


namespace VIT.Web.Admin
{
    public partial class ArticleComment : VITComponent
    {
        private int vId
        {
            get
            {
                int result = 0;
                int.TryParse(Request["sId"], out result);
                return result;
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
        }

        #region Methods
        public void deleteList(string[] listId)
        {
            VITData.OpenTransaction();
            foreach (string id in listId)
            {
                VITData.DeleteObject<Article_Comment>(o => o.Id == Convert.ToInt32(id));
            }
            VITData.CommitTransaction();
        }
        #endregion

        #region Events
        protected void Delete_Click(object sender, EventArgs e)
        {
            string[] check = Request["itemCheckbox"].Split(',');
            deleteList(check);
        }

        protected void Pager_PreRender(object sender, EventArgs e)
        {
            var list = VITData.GetQuery<Article_Comment>(o => o.ArticleId == vId);
            ListView.DataSource = list;
            ListView.DataBind();
        }
        #endregion                
    }
}
